<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>一键生成代码</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="/easy-generator/lib/layui-v2.5.5/css/layui.css" media="all">
    <link rel="stylesheet" href="/easy-generator/lib/font-awesome-4.7.0/css/font-awesome.min.css" media="all">
    <link rel="stylesheet" href="/easy-generator/css/public.css" media="all">
    <link rel="stylesheet"
          href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/styles/base16/xcode-dusk.min.css"
          integrity="sha512-Jfd6GpAJdSVJMMyRhvwdievOm+8F9YwSkXEz7OjsfMtPv1S96QoMDBys9WSF1C0/CJYhLVHSFfC7hEQZTjW3xw=="
          crossorigin="anonymous" referrerpolicy="no-referrer"/>
    <link
            rel="stylesheet"
            href="https://unpkg.com/highlightjs-copy/dist/highlightjs-copy.min.css"
    />
</head>
<body>
<div class="layuimini-container">
    <div class="layui-tab layui-tab-card" lay-filter="files">
        <ul class="layui-tab-title">
        </ul>
        <div class="layui-tab-content" style="height: 100%;">
        </div>
    </div>
</div>
<script src="/easy-generator/js/common/common.js" charset="utf-8"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/highlight.min.js"></script>
<script src="https://unpkg.com/highlightjs-copy/dist/highlightjs-copy.min.js"></script>
<script charset="utf-8">
    hljs.addPlugin(new CopyButtonPlugin());

    function dataEcho(data, hideSaveBtn) {
        layui.define(["element", "laytpl", "jquery", "code"], function (exports) {
            var element = layui.element,
                $ = layui.$,
                laytpl = layui.laytpl,
                layer = layui.layer;
            postAjax(basePath + "/api/file/file", data, function (result) {
                var data = result.data;
                Object.keys(data).forEach(key => {
                    var suffix = key.substring(key.lastIndexOf(".") + 1);
                    if (suffix == "vue") {
                        suffix = "html";
                    }
                    element.tabAdd('files', {
                        title: key
                        ,
                        content: "<pre><code class=\"language-" + suffix + " linenums\" id=\"copyCode_" + key + "\">" + data[key] + "</code></pre>"
                        ,
                        id: key
                    });
                    element.tabChange("files", key)
                    hljs.highlightAll();
                })

            });
        });
    }
</script>
</body>
</html>